package input.pilot;

import logic.nodes.MoveForwardController;
import logic.ships.Ship;

import com.jme.input.controls.GameControl;
import com.jme.math.Vector3f;

public class StrafeController extends MoveForwardController {
	
	private static final long serialVersionUID = 1L;
	
	protected Ship ship;
	
	public StrafeController(Ship node, GameControl forwardControl, float maxSpeed, 
			float acceleration, GameControl breakControl, float breaking) {
		super(node, forwardControl, maxSpeed, 0f, acceleration, breakControl, breaking);
		ship = node;
	}
	
	@Override
	protected void move(float tpf) {
		Vector3f forwardStep = node.getLocalRotation().getRotationColumn(0).mult(currentSpeed * tpf);
		node.getLocalTranslation().addLocal(forwardStep);
	}
	
	@Override
	public Vector3f getMoveDirection() { return ship.getLeftDirection().normalize(); }
}